﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title> @ViewBag.Title </title>
    <link href="~/Content/bootstrap.min.css" rel="stylesheet" />
    <style>
        #lay{
            width:550px;
            margin:auto;
            transform:translateY(25%)

        }
        h2{
            text-align:center;
        }
        .form-group{
            display:flex;
            padding:10px 20px;
        }
        .btn{
            width:220px;
            margin-left:177px;
        }
        .lab{
            display:block;
            width:100px;
        }
        a{
            font-size:10px;
        }
    </style>
</head>
<body>
    <div id="lay" class="shadow p-3 mb-5 bg-white rounded">
        @RenderBody()
       
    </div>
    

    <script src="~/Scripts/jquery-3.6.0.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script>

        $("#login-form .btn").on("click", function () {
            $.ajax({
                type: "post",
                url: "/User/LoginVtr",
                data: $("#login-form").serialize(),
                success: function (data) {
                    console.log(data)
                    let { err, msg } = data;
                    if (err) {
                        alert(msg);
                    }
                    else {
                        location.href="/Home/Index"
                    }
                }

            })
        })

        $("#register-form .btn").on("click", function () {
            $.ajax({
                type: "post",
                url: "/User/RegisterVtr",
                data: $("#register-form").serialize(),
                success: function (data) {
                    
                    let { err, msg } = data;

                    alert(msg);
                    if (!err) {
                        location.href="/User/Login"
                    }
                    
                }

            })
        })
    </script>
</body>
</html>
